package vnreal.gui.menu;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.UIManager;

public class SetCustomersPanel extends JFrame implements ActionListener {
	private JTextField textField;
	private JTextField textField_1;

	SetCustomersPanel() {
		super("Set Customers");
		{
			JDialog dialog = new JDialog();
			dialog.setLayout(new BorderLayout());
			// dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

			JPanel top = new JPanel();
			JLabel label;
			label = new JLabel("Virtual Network");
			label.setPreferredSize(new Dimension(80, 20));
			label.setHorizontalAlignment(JLabel.LEFT);
			label.setVerticalAlignment(JLabel.TOP);
			top.add(label);
			label = new JLabel("Customers");
			label.setPreferredSize(new Dimension(80, 20));
			label.setHorizontalAlignment(JLabel.RIGHT);
			label.setVerticalAlignment(JLabel.TOP);
			top.add(label);
			
			JPanel bottom = new JPanel();
			bottom.setLayout(new GridLayout(1,2));
			
			JButton addbutton = new JButton("Add");
			// addbutton.addActionListener();
			bottom.add(addbutton);

			JButton editbutton = new JButton("Edit");
			// editbutton.addActionListener();
			bottom.add(editbutton);





			
			JButton okButton = new JButton("OK");
			bottom.add(okButton);
			// okButton.addActionListener();
			// dialog.add(okButton);
			
	
			
			
			
			JButton cancelButton = new JButton("Cancel");
			bottom.add(cancelButton);
			// cancelButton.addActionListener();
			//dialog.add(cancelButton);
			
			
			dialog.add(top,BorderLayout.NORTH);
			dialog.add(bottom,BorderLayout.SOUTH);
			dialog.setSize(500, 200);
			dialog.setResizable(false);
			// dialog.setAlwaysOnTop(true);
			dialog.setVisible(true);
		}
	}

	public void initUI() {
		JPanel basic = new JPanel();
		getContentPane().add(basic);

		// topPanel.setMaximumSize(new Dimension(450, 0));

		ImageIcon icon = new ImageIcon("jdev.png");

		JPanel textPanel = new JPanel(new BorderLayout());
		textPanel.setBorder(BorderFactory.createEmptyBorder());

		String listData[] = { "Item 1", "Item 2", "Item 3", "Item 4" };
		basic.setLayout(null);

		JPanel bottom = new JPanel();
		bottom.setBounds(27, 76, 135, 37);
		bottom.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		textField = new JTextField();
		textField.setHorizontalAlignment(SwingConstants.TRAILING);
		bottom.add(textField);
		textField.setColumns(5);
		basic.add(bottom);

		textField_1 = new JTextField();
		textField_1.setColumns(5);
		textField_1.setHorizontalAlignment(SwingConstants.TRAILING);
		bottom.add(textField_1);

		JPanel panel = new JPanel();
		panel.setBounds(37, 113, 123, 37);
		basic.add(panel);

		JButton set = new JButton("SET");
		set.setBounds(5, 5, 51, 23);
		set.setMnemonic(KeyEvent.VK_N);
		JButton close = new JButton("Close");
		close.setBounds(61, 5, 59, 23);
		close.setMnemonic(KeyEvent.VK_C);
		panel.setLayout(null);
		panel.add(set);
		panel.add(close);

		JPanel panel_1 = new JPanel();
		panel_1.setBounds(47, 0, 83, 76);
		FlowLayout flowLayout = (FlowLayout) panel_1.getLayout();
		flowLayout.setAlignment(FlowLayout.LEADING);
		flowLayout.setAlignOnBaseline(true);
		basic.add(panel_1);

		JSplitPane splitPane = new JSplitPane();
		splitPane.setContinuousLayout(true);
		panel_1.add(splitPane);

		JList vn = new JList(listData);
		vn.setBackground(UIManager.getColor("Button.background"));
		splitPane.setLeftComponent(vn);

		JList customers = new JList(listData);
		customers.setBackground(UIManager.getColor("Button.background"));
		splitPane.setRightComponent(customers);

		setTitle("Set Customers");
		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
		setLocationRelativeTo(null);
		setVisible(true);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		String cmd = e.getActionCommand();
		if (cmd.equals("set")) {
		}
	}

}
